home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / g_man / cat3 / OpenGL / glfog.z / glfog
Encoding:
Text File  |  2002-10-03  |  19.1 KB  |  348 lines

  1.  
  2.  
  3.  
  4. ggggllllFFFFoooogggg((((3333GGGG))))                      OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                      ggggllllFFFFoooogggg((((3333GGGG))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      ggggllllFFFFooooggggffff,,,, ggggllllFFFFooooggggiiii,,,, ggggllllFFFFooooggggffffvvvv,,,, ggggllllFFFFooooggggiiiivvvv - specify fog parameters
  10.  
  11.  
  12. CCCC SSSSPPPPEEEECCCCIIIIFFFFIIIICCCCAAAATTTTIIIIOOOONNNN
  13.      void ggggllllFFFFooooggggffff( GLenum _p_n_a_m_e,
  14.                   GLfloat _p_a_r_a_m )
  15.      void ggggllllFFFFooooggggiiii( GLenum _p_n_a_m_e,
  16.                   GLint _p_a_r_a_m )
  17.  
  18.  
  19. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  20.      _p_n_a_m_e   Specifies a single-valued fog parameter.  GGGGLLLL____FFFFOOOOGGGG____MMMMOOOODDDDEEEE,
  21.              GGGGLLLL____FFFFOOOOGGGG____DDDDEEEENNNNSSSSIIIITTTTYYYY, GGGGLLLL____FFFFOOOOGGGG____SSSSTTTTAAAARRRRTTTT, GGGGLLLL____FFFFOOOOGGGG____EEEENNNNDDDD, and GGGGLLLL____FFFFOOOOGGGG____IIIINNNNDDDDEEEEXXXX are
  22.              accepted.
  23.  
  24.      _p_a_r_a_m   Specifies the value that _p_n_a_m_e will be set to.
  25.  
  26. CCCC SSSSPPPPEEEECCCCIIIIFFFFIIIICCCCAAAATTTTIIIIOOOONNNN
  27.      void ggggllllFFFFooooggggffffvvvv( GLenum _p_n_a_m_e,
  28.                    const GLfloat *_p_a_r_a_m_s )
  29.      void ggggllllFFFFooooggggiiiivvvv( GLenum _p_n_a_m_e,
  30.                    const GLint *_p_a_r_a_m_s )
  31.  
  32.  
  33. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  34.      _p_n_a_m_e
  35.           Specifies a fog parameter.  GGGGLLLL____FFFFOOOOGGGG____MMMMOOOODDDDEEEE, GGGGLLLL____FFFFOOOOGGGG____DDDDEEEENNNNSSSSIIIITTTTYYYY,
  36.           GGGGLLLL____FFFFOOOOGGGG____SSSSTTTTAAAARRRRTTTT, GGGGLLLL____FFFFOOOOGGGG____EEEENNNNDDDD, GGGGLLLL____FFFFOOOOGGGG____IIIINNNNDDDDEEEEXXXX, GGGGLLLL____FFFFOOOOGGGG____CCCCOOOOLLLLOOOORRRR, and
  37.           GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX are accepted.
  38.  
  39.      _p_a_r_a_m_s
  40.           Specifies the value or values to be assigned to _p_n_a_m_e.  GGGGLLLL____FFFFOOOOGGGG____CCCCOOOOLLLLOOOORRRR
  41.           requires an array of four values to specify the RGBA components of
  42.           the fog color.  GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX requires an array of four
  43.           values to specify a reference point in eye-space coordinates, and a
  44.           Z offset in eye-space coordinates.  All other parameters accept an
  45.           array containing only a single value.
  46.  
  47. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  48.      Fog is initially disabled.  While enabled, fog affects rasterized
  49.      geometry, bitmaps, and pixel blocks, but not buffer clear operations. To
  50.      enable and disable fog, call ggggllllEEEEnnnnaaaabbbblllleeee and ggggllllDDDDiiiissssaaaabbbblllleeee with argument GGGGLLLL____FFFFOOOOGGGG.
  51.  
  52.      ggggllllFFFFoooogggg assigns the value or values in _p_a_r_a_m_s to the fog parameter
  53.      specified by _p_n_a_m_e.  The following values are accepted for _p_n_a_m_e:
  54.  
  55.      GGGGLLLL____FFFFOOOOGGGG____MMMMOOOODDDDEEEE         _p_a_r_a_m_s is a single integer or floating-point value
  56.                          that specifies the equation to be used to compute the
  57.                          fog blend factor, f.  Four symbolic constants are
  58.                          accepted:  GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR, GGGGLLLL____EEEEXXXXPPPP, GGGGLLLL____EEEEXXXXPPPP2222, and
  59.                          GGGGLLLL____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____SSSSGGGGIIIISSSS.  The equations corresponding to
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ggggllllFFFFoooogggg((((3333GGGG))))                      OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                      ggggllllFFFFoooogggg((((3333GGGG))))
  71.  
  72.  
  73.  
  74.                          these symbolic constants are defined below.  The
  75.                          initial fog mode is GGGGLLLL____EEEEXXXXPPPP.
  76.  
  77.      GGGGLLLL____FFFFOOOOGGGG____DDDDEEEENNNNSSSSIIIITTTTYYYY      _p_a_r_a_m_s is a single integer or floating-point value
  78.                          that specifies density, the fog density used in both
  79.                          exponential fog equations.  Only nonnegative
  80.                          densities are accepted.  The initial fog density is
  81.                          1.
  82.  
  83.      GGGGLLLL____FFFFOOOOGGGG____SSSSTTTTAAAARRRRTTTT        _p_a_r_a_m_s is a single integer or floating-point value
  84.                          that specifies start, the near distance used in the
  85.                          linear fog equation.  The initial near distance is 0.
  86.  
  87.      GGGGLLLL____FFFFOOOOGGGG____EEEENNNNDDDD          _p_a_r_a_m_s is a single integer or floating-point value
  88.                          that specifies end, the far distance used in the
  89.                          linear fog equation.  The initial far distance is 1.
  90.  
  91.      GGGGLLLL____FFFFOOOOGGGG____IIIINNNNDDDDEEEEXXXX        _p_a_r_a_m_s is a single integer or floating-point value
  92.                          that specifies i , the fog color index.  The initial
  93.                                          f
  94.                          fog index is 0.
  95.  
  96.      GGGGLLLL____FFFFOOOOGGGG____CCCCOOOOLLLLOOOORRRR        _p_a_r_a_m_s contains four integer or floating-point values
  97.                          that specify C , the fog color.  Integer values are
  98.                                        f
  99.                          mapped linearly such that the most positive
  100.                          representable value maps to 1.0, and the most
  101.                          negative representable value maps to -1.0.
  102.                          Floating-point values are mapped directly.  After
  103.                          conversion, all color components are clamped to the
  104.                          range [0,1].  The initial fog color is (0, 0, 0, 0).
  105.  
  106.      GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX
  107.                          _p_a_r_a_m_s contains four integer or floating-point
  108.                          values.  The first three specify a reference point as
  109.                          X, Y, and Z eye coordinates.  The fourth specifies a
  110.                          Z offset in eye coordinates.  The offset is used to
  111.                          modify z in the fog equations described below, so
  112.                          that bright objects (such as emissive objects
  113.                          representing light sources) will have a more
  114.                          realistic appearance in heavily-fogged environments.
  115.                          The significance of the reference point is discussed
  116.                          below.  Integer values are mapped linearly such that
  117.                          the most positive representable value maps to 1.0,
  118.                          and the most negative representable value maps to
  119.                          -1.0.  Floating-point values are mapped directly.
  120.                          The initial value is (0,0,0,0).
  121.  
  122.      Fog blends a fog color with each rasterized pixel fragment's
  123.      posttexturing color using a blending factor f.  Factor f is computed in
  124.      one of four ways, depending on the fog mode.  Let z be the distance in
  125.      eye coordinates from the origin to the fragment being fogged.  If
  126.      GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____SSSSGGGGIIIIXXXX is enabled, subtract the Z offset specified by
  127.      GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX from z, and clamp the result so that it is
  128.  
  129.  
  130.  
  131.                                                                         PPPPaaaaggggeeee 2222
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. ggggllllFFFFoooogggg((((3333GGGG))))                      OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                      ggggllllFFFFoooogggg((((3333GGGG))))
  139.  
  140.  
  141.  
  142.      greater than or equal to zero.
  143.  
  144.      The equation for GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR fog is
  145.  
  146.                                                  end - z___________
  147.                                   f =
  148.                                       end - start
  149.  
  150.  
  151.  
  152.      The equation for GGGGLLLL____EEEEXXXXPPPP fog is
  153.  
  154.                                                .
  155.                                      -(density   z)
  156.                                 f = e
  157.  
  158.  
  159.  
  160.      The equation for GGGGLLLL____EEEEXXXXPPPP2222 fog is
  161.  
  162.                                               .   2
  163.                                     -(density   z)
  164.                                f = e
  165.  
  166.  
  167.  
  168.      The blending factor for GGGGLLLL____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____SSSSGGGGIIIISSSS fog is determined by
  169.      interpolating a set of application-defined control points.  ggggllllFFFFooooggggFFFFuuuunnnnccccSSSSGGGGIIIISSSS
  170.      is used to specify the control points.  Each control point consists of a
  171.      pair of floating-point numbers.  The first number of the pair specifies a
  172.      value of z, and the second number of the pair specifies a value of f.
  173.      The GL fits a curve through all the control points.  This curve may be
  174.      piecewise linear or it may be smoothed, but it will pass through the
  175.      control points exactly (limited only by the resolution of the
  176.      implementation).  If a given z is less than or equal to the z of the
  177.      first control point, then the resulting value of f is the f of the first
  178.      control point.  If z is greater than or equal to the z of the last
  179.      control point, then the resulting value of f is the f of the last control
  180.      point.  Otherwise, f is determined by finding the point on the curve that
  181.      corresponds to the given z.
  182.  
  183.  
  184.      Regardless of the fog mode, f is clamped to the range [0, 1] after it is
  185.      computed.  Then, if the GL is in RGBA color mode, the fragment's red,
  186.      green, and blue colors, represented by C , are replaced by
  187.                                              r
  188.  
  189.                                   '
  190.                                 C   = fC  + (1-f)C
  191.                                  r      r         f
  192.  
  193.  
  194.      Fog does not affect a fragment's alpha component.
  195.  
  196.      In color index mode, the fragment's color index i  is replaced by
  197.                                                       r
  198.  
  199.                                   '
  200.                                 i   = i  + (1-f)i
  201.                                  r     r         f
  202.  
  203. NNNNOOOOTTTTEEEESSSS
  204.      In perspective projections, a Z offset in eye coordinates will map to
  205.      different Z offsets in window coordinates at various points in the range
  206.      of Z.  Machines that evaluate the fog blending factor by using a window Z
  207.      coordinate to index a table must therefore compute the window-coordinate
  208.      Z offset relative to some reference point.  This is the purpose of the
  209.  
  210.  
  211.  
  212.                                                                         PPPPaaaaggggeeee 3333
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219. ggggllllFFFFoooogggg((((3333GGGG))))                      OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                      ggggllllFFFFoooogggg((((3333GGGG))))
  220.  
  221.  
  222.  
  223.      reference point specified by the first three values in _p_a_r_a_m_s when _p_n_a_m_e
  224.      is GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX.  For best fog accuracy in perspective
  225.      projections, this reference point must be close to the objects being
  226.      fogged.
  227.  
  228.      In parallel projections the window-coordinate Z offset does not vary with
  229.      position in the Z range, so the reference point is ignored.
  230.  
  231.      GGGGLLLL____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____SSSSGGGGIIIISSSS is part of the SSSSGGGGIIIISSSS____ffffoooogggg____ffffuuuunnnncccc extension, not part of the
  232.      core GL command set.  If GGGGLLLL____SSSSGGGGIIIISSSS____ffffoooogggg____ffffuuuunnnncccc is included in the string
  233.      returned by ggggllllGGGGeeeettttSSSSttttrrrriiiinnnngggg when called with argument GGGGLLLL____EEEEXXXXTTTTEEEENNNNSSSSIIIIOOOONNNNSSSS,
  234.      extension SSSSGGGGIIIISSSS____ffffoooogggg____ffffuuuunnnncccc is supported by the connection.  See ggggllllIIIInnnnttttrrrroooo for
  235.      more information about using extensions.
  236.  
  237.      GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX is part of the SSSSGGGGIIIIXXXX____ffffoooogggg____ooooffffffffsssseeeetttt extension, and
  238.      similar considerations apply.
  239.  
  240. EEEERRRRRRRROOOORRRRSSSS
  241.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____EEEENNNNUUUUMMMM is generated if _p_n_a_m_e is not an accepted value, or if
  242.      _p_n_a_m_e is GGGGLLLL____FFFFOOOOGGGG____MMMMOOOODDDDEEEE and _p_a_r_a_m_s is not an accepted value.
  243.  
  244.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____VVVVAAAALLLLUUUUEEEE is generated if _p_n_a_m_e is GGGGLLLL____FFFFOOOOGGGG____DDDDEEEENNNNSSSSIIIITTTTYYYY, and _p_a_r_a_m_s is
  245.      negative.
  246.  
  247.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN is generated if ggggllllFFFFoooogggg is executed between the
  248.      execution of ggggllllBBBBeeeeggggiiiinnnn and the corresponding execution of ggggllllEEEEnnnndddd.
  249.  
  250. AAAASSSSSSSSOOOOCCCCIIIIAAAATTTTEEEEDDDD GGGGEEEETTTTSSSS
  251.      ggggllllIIIIssssEEEEnnnnaaaabbbblllleeeedddd with argument GGGGLLLL____FFFFOOOOGGGG
  252.      ggggllllIIIIssssEEEEnnnnaaaabbbblllleeeedddd with argument GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____SSSSGGGGIIIIXXXX
  253.      ggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____CCCCOOOOLLLLOOOORRRR
  254.      ggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____SSSSGGGGIIIISSSS
  255.      ggggllllGGGGeeeetttt with argument GGGGLLLL____MMMMAAAAXXXX____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____PPPPOOOOIIIINNNNTTTTSSSS____SSSSGGGGIIIISSSS
  256.      ggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____IIIINNNNDDDDEEEEXXXX
  257.      ggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____DDDDEEEENNNNSSSSIIIITTTTYYYY
  258.      ggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____SSSSTTTTAAAARRRRTTTT
  259.      ggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____EEEENNNNDDDD
  260.      ggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____MMMMOOOODDDDEEEE
  261.      ggggllllGGGGeeeetttt with argument GGGGLLLL____FFFFOOOOGGGG____OOOOFFFFFFFFSSSSEEEETTTT____VVVVAAAALLLLUUUUEEEE____SSSSGGGGIIIIXXXX
  262.  
  263.  
  264. MMMMAAAACCCCHHHHIIIINNNNEEEE DDDDEEEEPPPPEEEENNNNDDDDEEEENNNNCCCCIIIIEEEESSSS
  265.      Fog mode GGGGLLLL____FFFFOOOOGGGG____FFFFUUUUNNNNCCCC____SSSSGGGGIIIISSSS is supported only on IIIInnnnffffiiiinnnniiiitttteeeeRRRReeeeaaaalllliiiittttyyyy systems.
  266.  
  267.      The fog offset capability is supported only on IIIInnnnffffiiiinnnniiiitttteeeeRRRReeeeaaaalllliiiittttyyyy systems.
  268.  
  269.      On IIIInnnnffffiiiinnnniiiitttteeeeRRRReeeeaaaalllliiiittttyyyy systems, fog cannot be used with color-index visuals
  270.      that are 2 or 4 bits deep.  Accordingly, these visuals are marked as
  271.      non-conforming.
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.                                                                         PPPPaaaaggggeeee 4444
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285. ggggllllFFFFoooogggg((((3333GGGG))))                      OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee                      ggggllllFFFFoooogggg((((3333GGGG))))
  286.  
  287.  
  288.  
  289. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  290.      ggggllllEEEEnnnnaaaabbbblllleeee, ggggllllFFFFooooggggFFFFuuuunnnnccccSSSSGGGGIIIISSSS
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.                                                                         PPPPaaaaggggeeee 5555
  345.  
  346.  
  347.  
  348.